﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0,minimal-ui,viewport-fit=cover">
    <title>沙孟海</title>
    <link rel="stylesheet" href="~/Areas/Study/css/app.css">
    <link rel="stylesheet" href="~/Areas/Study/css/chunk-191789d7.83118e3f.css">
    <link rel="stylesheet" href="~/Areas/Study/css/chunk-a5a92988.2f5d1efc.css">
    <link rel="stylesheet" href="~/Areas/Study/css/chunk-vendors.f8e2a465.css">
</head>
<body style="background-color:#FFF9F0;">
    <svg aria-hidden="true" style="position: absolute; width: 0px; height: 0px; overflow: hidden;">
    </svg>
    <noscript><strong>We're sorry but Edu doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>
    <div id="app">
        <div data-v-3ef8012a="" class="loginbox">
            <div data-v-3ef8012a="" class="login2">
                <div data-v-3ef8012a="" class="item">
                    <h3 data-v-3ef8012a="">
                        <img data-v-3ef8012a="" src="~/Areas/Study/image/login_title.png">
                    </h3>
                    <div data-v-3ef8012a="" class="login-group">
                        <div data-v-3ef8012a="" class="van-cell van-field">
                            <div class="van-field__left-icon">
                                <i class="van-icon">
                                    <img src="~/Areas/Study/image/user.png" class="van-icon__image">
                                </i>
                            </div>
                            <div class="van-cell__value van-cell__value--alone van-field__value">
                                <div class="van-field__body">
                                    <input type="text" id="txtUserName" placeholder="请输入手机号" class="van-field__control">
                                </div>
                            </div>
                        </div>
                        <div data-v-3ef8012a="" class="van-cell van-field">
                            <div class="van-field__left-icon">
                                <i class="van-icon">
                                    <img src="~/Areas/Study/image/code.png" class="van-icon__image">
                                </i>
                            </div>
                            <div class="van-cell__value van-cell__value--alone van-field__value">
                                <div class="van-field__body">
                                    <input id="txtMsgCode" type="text" placeholder="请输入验证码" class="van-field__control" maxlength="6">
                                </div>
                            </div>
                            <div class="van-field__left-icon">
                                <i class="van-text" onclick="SendSms(this)">
                                    获取验证码
                                </i>
                            </div>
                        </div>
                        <button data-v-3ef8012a="" class="login_btn van-button van-button--info van-button--large van-button--round"  onclick="login()">
                            <div data-v-3ef8012a="" class="van-button__content">
                                <span data-v-3ef8012a="" class="van-button__text">立即登录</span>
                            </div>
                        </button>
                        <button data-v-3ef8012a="" class="login_btn_yzm van-button van-button--info van-button--large van-button--plain van-button--round" onclick="javascript:window.location.href='@Url.Action("PassWordLogin", "Login")'">
                            <div data-v-3ef8012a="" class="van-button__content">
                                <span data-v-3ef8012a="" class="van-button__text">切换密码登录 </span>
                            </div>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<style type="text/css">
    #rwl-iqxin {
        position: fixed;
        transform: translate(-95px,0);
        width: 85px;
        height: 25px;
        font-size: 12px;
        font-weight: 500;
        font-family: Verdana, Arial, '宋体';
        color: #fff;
        background: #333;
        z-index: 2147483647;
        margin: 0;
        opacity: 0.05;
        transition: 0.3s;
        overflow: hidden;
        user-select: none;
        text-align: center;
        white-space: nowrap;
        line-height: 25px;
        padding: 0 16px;
        border: 1px solid #ccc;
        border-width: 1px 1px 1px 0;
        border-bottom-right-radius: 5px;
        box-sizing: content-box;
    }

        #rwl-iqxin input {
            margin: 0;
            padding: 0;
            vertical-align: middle;
            -webkit-appearance: checkbox;
            -moz-appearance: checkbox;
            position: static;
            clip: auto;
            opacity: 1;
            cursor: pointer;
        }

        #rwl-iqxin.rwl-active-iqxin {
            left: 0px;
            transform: translate(0,0);
            opacity: 0.9;
            height: 32px;
            line-height: 32px
        }

        #rwl-iqxin label {
            margin: 0;
            padding: 0;
            font-weight: 500;
        }

        #rwl-iqxin #rwl-setbtn {
            margin: 0 4px 0 0;
            padding: 0 0 0 4px;
            border: none;
            border-radius: 2px;
            cursor: pointer;
            background: #fff;
            color: #000;
        }
</style>
<script type="text/javascript" src="~/Areas/Study/js/jquery-1.10.2.min.js"></script>
<script>
    //调整显示
    function foo(obj, time) {
        $(obj).attr("disable", true);
        $(obj).text((time / 1000) + "秒后重新发送");
        $(".get-code").attr("style", "font-size: 12px");
        setTimeout(function () {
            var x = setInterval(function () {
                time = time - 1000;
                $(obj).text((time / 1000) + "秒后重新发送");
                if (time == 0) {
                    clearInterval(x);
                    $(obj).attr("disable", false);
                    $(obj).text("获取验证码");
                }
            }, 1000);
        }, time - 60000);
    }

    //发送验证码
    function SendSms(dom) {
        console.log($(dom).attr("disable"));
        if ($(dom).attr("disable") == null || $(dom).attr("disable") == "false") {
            var userName = $("#txtUserName").val();
            //判断
            if (userName == undefined || userName == null || userName == "") {
                alert("手机不能为空");
                return;
            }

            $.ajax({
                type: "POST",
                url: '@Url.Action("SendSms","Login")',
                data: { "Phone": userName, "type": 0 },
                success: function (Msg) {
                    if (Msg.Success) {
                        foo(dom, 60000);
                    }
                    alert(Msg.Message);
                },
                error: function () {
                    alert("发送失败");
                }
            });
        }
    }

    //检测
    function check() {
        //账号
        var userName = $("#txtUserName").val();
        if (userName == undefined || userName == null || userName == "") {
            alert("账号不能为空");
            return false;
        }

        //验证码
        var msgCode = $("#txtMsgCode").val();
        if (msgCode == undefined || msgCode == null || msgCode == "") {
            alert("验证码不能为空");
            return false;
        }
        return true;
    };

    //登录
    function login() {
        if (check()) {
            var userName = $("#txtUserName").val();
            var msgCode = $("#txtMsgCode").val();

            $.ajax({
                type: "POST",
                url: '@Url.Action("MsgCodeLogin", "Login")',
                data: {
                    "userName": userName,
                    "msgCode": msgCode
                },
                success: function (res) {
                    if (res.Success) {
                        window.location.href = res.Data ;//直接跳转
                    } else {
                        alert(res.Message);
                    }
                }
            });
        }
    }
</script>